package com.t2t.top.outmemory;

import java.util.ArrayList;
import java.util.List;

/**
 * 1. Java堆溢出
 * <p/>
 * VM Args:-Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError
 */
public class HeapOOM {
    static class OOMObject {
    }

    public static void main(String[] args) throws InterruptedException {
        List<OOMObject> list = new ArrayList();
        while (true) {
            list.add(new OOMObject());
            Thread.sleep(10 * 100);
        }
    }
}